﻿using System.Windows.Forms;

namespace FsAddInManager
{
	public class Node : TreeNode
	{
		public new bool Checked
		{
			get
			{
				return base.Checked;
			}
			set
			{
				base.Checked = value;
				this.Save = value;
			}
		}

		public bool Save
		{
			get
			{
				IAddinNode addinNode = base.Tag as IAddinNode;
				return addinNode != null && addinNode.Save;
			}
			set
			{
				IAddinNode addinNode = base.Tag as IAddinNode;
				if (addinNode == null)
				{
					return;
				}
				addinNode.Save = value;
			}
		}

		public bool Hidden
		{
			get
			{
				IAddinNode addinNode = base.Tag as IAddinNode;
				return addinNode != null && addinNode.Hidden;
			}
			set
			{
				IAddinNode addinNode = base.Tag as IAddinNode;
				if (addinNode == null)
				{
					return;
				}
				addinNode.Hidden = value;
			}
		}

		public Node(string name) : base(name)
		{
		}

		public new Node Parent
		{
			get
			{
				return base.Parent as Node;
			}
		}
	}
}
